package net.atomarrow.util;

import javax.servlet.http.HttpServletRequest;
/**
 * server 工具类
 * @author Michael
 *
 */
public class ServerUtil {
    public static String getIp(HttpServletRequest request) {
        String remoteAddr = request.getHeader("X-Real-IP");
        if (remoteAddr == null) {
            remoteAddr = request.getHeader("X-Forwarded-For");
        }
        if (remoteAddr == null) {
            remoteAddr = request.getRemoteAddr();
        }
        return remoteAddr;
    }
}
